export add_to
"Add new columns to a table"
add_to(w::WithContext, args...) =
    add_to(evaluate!(w), args...)

export order
"Order the rows of a table"
order(w::WithContext, args...) =
    order(evaluate!(w), args...)


export rename
"Change the column names of a table"
rename(w::WithContext, args...) =
    rename(evaluate!(w), args...)

export make_from
"Make a new table"
make_from(w::WithContext, args...) =
    make_from(evaluate!(w), args...)

export with
"Evaluate in the context of a table"
with(w::WithContext, args...) =
    with(evaluate!(w), args...)

export columns_from
"Choose columns from a table"
columns_from(w::WithContext, args...) =
    columns_from(evaluate!(w), args...)

export rows_from
"""
    @rows_from table *wherever* condition
    @rows_from table *at* indices

Select rows meeting a certain condition or at certain indexes
"""
rows_from(w::WithContext, args...) =
    rows_from(evaluate!(w), args...)

export group
"""
    @group table *by* columns...

Group a table
"""
group(w::WithContext, args...) =
    group(evaluate!(w), args...)

export ungroup
"Ungroup a table"
ungroup(w::WithContext, args...) =
    ungroup(evaluate!(w), args...)

export fuze
"""
- `@fuze x and y` for an inner join
- `@fuze x or y` for an outer join.
- `@fuze x into y` for a right join.
- `@fuze x with y` for a semi join.
- `@fuze x without y` for an anti-join.

Join two tables together by common columns.

If there are no column columns, cross join (and the conjuction won't matter).
"""
fuze(source1::WithContext, conjunction, source2::WithContext, args...) =
    fuze(evaluate!(source1), conjunction, evaluate!(source2), args...)

export gather_from
"""
    @gather_from table columns...

Gather columns from a table into key and value columns
"""
gather_from(w::WithContext, args...) =
    gather_from(evaluate!(w), args...)

export spread_from
"""
    @spread_from table value over key

Create new columns from a key and a value column
"""
spread_from(w::WithContext, args...) =
    spread_from(evaluate!(w), args...)

export split_columns
"Split a column into several columns"
split_columns(w::WithContext, args...) =
    split_columns(evaluate!(w), args...)

export split_rows
"Split a column with nested rows"
split_rows(w::WithContext, args...) =
    split_rows(evaluate!(w), args...)

export output
"""
    @output table
    @output table into atype

Collect a query
"""
output(w::WithContext, args...) =
    output(evaluate!(w), args...)
